
all:
	rm -rf dist
	mkdir dist
	cp -r ../xiaowu/static/* ./dist/
	GOOS=js GOARCH=wasm go build -o xiaowu-web.wasm
	echo "const XiaowuWebWasm = 'data:application/wasm;base64," > ./dist/xiaowu-web-wasm.js
	base64 xiaowu-web.wasm >> ./dist/xiaowu-web-wasm.js
	echo "';" >> ./dist/xiaowu-web-wasm.js
	tr -d "\n" < ./dist/xiaowu-web-wasm.js > ./dist/xiaowu-web-wasm.js.new
	mv ./dist/xiaowu-web-wasm.js.new ./dist/xiaowu-web-wasm.js
	# from go 1.24 /lib/wasm
	cp "`go env GOROOT`/lib/wasm/wasm_exec.js" ./dist/


